package com.itheima.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;


import javax.annotation.Resource;

@DubboService
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    RabbitTemplate rabbitTemplate;
    @Override
    public Boolean AddUser(User user) {
        boolean flag = this.save(user);
        System.out.println(flag);
        if (flag){
            rabbitTemplate.convertAndSend("itheima","Routing_hello",user.getEmail());
        }

        return flag;
    }
    }

